<!DOCTYPE html>
<html>

<head>
    <#include "/zz/components/meta.html" />
    <title>蓁奕科技 ${metaTitleSuffix!}</title>
    <#include "/zz/components/stylesheets.html" />
</head>

<body>
    <div id='app'>
        <el-container>
            <#assign menuIndex="1-1" />
            <#include "/zz/admin/components/menu.html" />
            <el-container>
                <#include "/zz/admin/components/header.html" />
                <el-main>
                    <template>
                        <el-button @click='onAdd'>新增</el-button>
                        <el-table :data="items" style="width: 100%">
                            <!-- <el-table-column prop="id" label="id">
                            </el-table-column> -->
                            <el-table-column prop="title" label="标题">
                            </el-table-column>
                            <el-table-column prop="subtitle" label="副标题">
                            </el-table-column>
                            <!-- <el-table-column prop="startTime" label="开始时间">
                            </el-table-column>
                            <el-table-column prop="endTime" label="结束时间">
                            </el-table-column> -->
                            <el-table-column prop="code" label="CODE" width="120">
                            </el-table-column>
                            <el-table-column prop="status" label="状态" width="80">
                                <template slot-scope="scope">
                                    <span v-if='scope.row.status == 0'>未开始</span>
                                    <span v-if='scope.row.status == 1'>报名中</span>
                                    <span v-if='scope.row.status == 2'>活动中</span>
                                    <span v-if='scope.row.status == 3'>已结束</span>
                                </template>
                            </el-table-column>
                            <!-- <el-table-column prop="sort" label="排序" width="80">
                            </el-table-column> -->
                            <el-table-column  label="操作" width="200">
                                <template slot-scope="scope">
                                    <el-button type="text" @click="onEdit(scope.row)">查看</el-button>
                                    <el-button type="text" @click="enrollList(scope.row)">报名名单</el-button>
                                    <el-button type="text" @click="onDelte(scope.row)" style="color: red;">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <#include '/components/page.html' />
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/zz/admin/components/footer.html" />
    </div>
    <#include "/zz/components/scripts.html" />
    <script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data() {
            return {
                items: ${items!'[]'}
            }
        },
        mounted: function() {},
        methods: {
            onAdd(){
                location.href = '/zz/admin/activity/info'
            },
            onEdit(info) {
                window.location.href = '/zz/admin/activity/info?activityId=' + info.id;
            },
            onDelte(info) {
                this.$confirm('确定删除?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    var param = {
                        activityId: info.id
                    }
                    axiosRequest(param, '/zz/admin/activity/delete', '')
                }).catch(() => {});
            },
            enrollList(info) {
                window.location.href = '/zz/admin/activity/enrollList?activityId=' + info.id;
            }
        },
        filters: {
            fmt(date) {
                return date
            }
        }
    })
    </script>
</body>

</html>